/*
**  Copyright (C), CHENGDU GONGWEI TECHNOLOGY CO.,LTD.
**
**  Project:	Manager Unit v1.0
**  File:    	
**  Author: 	zhaozhuyu
**  Date:    	2017/05/20
**
**  Purpose:
**    		.
**
**  History: 
**  <author>   <time>          <version >   <desc>
*	$$Author$$
*/

#ifndef __DEBUG_H__
#define __DEBUG_H__

/* Include files. */
#include <stdio.h>
#include <stdlib.h>

/* Macro constant definitions. */

/* Console colour definitions */
#define CON_COLOR_END               "\033[m"
#define CON_COLOR_GREEN             "\033[1;32m"
#define CON_COLOR_RED               "\033[1;31m"
#define CON_COLOR_PURPLE            "\033[1;35m"
#define CON_COLOR_YELLOW            "\033[1;33m"
#define CON_COLOR_CYAN              "\033[1;36m"
#define CON_COLOR_YELLOW_UNLINE     "\033[1;4;33m"

/* Type definitions. */
typedef enum 
{
	e_DEBUG = 1,
	e_INFO,
	e_WARN,
	e_ERR,
}e_debug;

/* External variable declarations. */

/* Macro API definitions. */

#define DEBUG(fmt, args...) \
	do {\
		muPrint(stdout, e_DEBUG, __FILE__, __LINE__, fmt, ##args);\
	} while(0)
	
#define INFO(fmt, args...) \
	do {\
		muPrint(stdout, e_INFO, __FILE__, __LINE__, fmt, ##args);\
	} while(0)
	
#define WARN(fmt, args...) \
	do {\
		muPrint(stdout, e_WARN, __FILE__, __LINE__, fmt, ##args);\
	} while(0)	
	
#define ERROR(fmt, args...) \
	do {\
		muPrint(stdout, e_ERR, __FILE__, __LINE__, fmt, ##args);\
	} while(0)


/* External function declarations. */
void debugChange();
void logFileClose();
int muPrint(FILE *fp, int level, const char *file, 
					const int line, const char *fmt, ...);
int muLuaPrint(FILE *fp, int level, const char *file, 
						const int line, const char *str);
int setDebugLevel(int level);
int setLuaDebugLevel(int level);
int getDebugLevel(void);

#endif
